define([
    "dojo/_base/declare",
    "gistech/widgets/normalDialog/NormalDialog",
    "dojo/text!./templates/Template.html",
    "dojo/_base/lang",
    "dojo/topic",
    "dojo/dom-style",
    "dojo/dom-construct",
    "dojo/on",
    "dojo/_base/array",
    "dojo/_base/connect",
    "gistech/util/ajaxUtil",
    "dojo/dom-style","dojo/query","dojo/dom-class",
    "gistech/widgets/FrontHeatDiagram/LandTypeRenderer",
    "esri/layers/FeatureLayer",
    "esri/layers/GraphicsLayer",
    "esri/InfoTemplate",
    "esri/tasks/QueryTask",
    "esri/tasks/query",
    "esri/tasks/GeometryService",
    "esri/symbols/SimpleLineSymbol",
    "esri/symbols/SimpleFillSymbol",
    "dijit/layout/ContentPane",
    "esri/graphic",
    "esri/SpatialReference",
    "esri/Color"],
    function(declare,NormalDialog,template,lang,Topic,style,domConstruct,on,array,eventconnect,ajaxUtil,domStyle,query,domClass,LandTypeRenderer,FeatureLayer,GraphicsLayer,InfoTemplate,QueryTask,ArcQuery,GeometryService
    		,SimpleLineSymbol,SimpleFillSymbol,ContentPane,Graphic,SpatialReferenceColor){
        return declare([NormalDialog],{
        templateString:template,
        container:null,
        constructor:function (args) {
        	debugger
        	this.map= args.map!=undefined ? args.map:null;
        	//表单验证
        	this.rulesObj={'s_city': {required: true},'s_county':{required: true}};
        	this.msgObj={'s_city': {required: ""},'s_county':{required: ""}};
        	//用户权限数据
        	this.userPermission={
    			"data":ioc.map.userRoleData,
    			"city":{}//{"广州市":[]}
        	},
        	this.inherited(arguments);
        },
        postCreate:function(){
            this.inherited(arguments);
            this.init();
            this.addEvents(0);
            //debugger
            this.frontHeatDiagramTbody=query('#frontHeatDiagramTbody',this.domNode)[0];//动态改变的主体body元素
            this.rowTemplate=query('#frontHeatDiagramTbody > tr',this.domNode)[0];//动态新增行时的模板
            //多条件需要传递后台查询传递的参数
            this.commonParam=null;
            this.landTypeParam=null;
            this.KGParam=null;
            this.TGParam=null;
            /*城市+区县的二级联动*/
            //debugger
            this.s=["s_city","s_county"];//三个select的name
            this.opt0 = ["市","区/县"];//初始值
            this._reConstructDsy();//重新构造市区数据  根据权限
            this._init_area();//初始化函数
            /**搜索的条件*/
            this.searchCon={};
            this.onlylandTypeCount=0;
            /**图层的url*/
            this.showLayer={
            	"纳入三旧的旧厂":{
            		url:mapinfoTemplate.JCFFL3.layerurl,
            		id:"threeOldFactory_advQuery",
            		queryFild:mapinfoTemplate.JCFFL3.queryFild,
            		queryFildValue:mapinfoTemplate.JCFFL3.queryFildValue,
            		areaField:mapinfoTemplate.JCFFL3.areaField,
            		//tableName:"SDDCGISDATA.JCF",
            		tableName:mapinfoTemplate.JCFFL3.tableName,
            		renderColor:"[255,20,147,0.8]",
            		condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.JCFFL3.template,
            		GZLX:"旧厂房",//对应数据库是   GZLX
            	    table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"旧厂房"
            		}
                },
            	"纳入三旧的旧城":{
            		url:mapinfoTemplate.JCHFL3.layerurl,
            		id:"threeOldCity_advQuery",
            		queryFild:mapinfoTemplate.JCHFL3.queryFild,
            		queryFildValue:mapinfoTemplate.JCHFL3.queryFildValue,
            		areaField:mapinfoTemplate.JCHFL3.areaField,
//            		tableName:"SDDCGISDATA.JCH",
            		tableName:mapinfoTemplate.JCHFL3.tableName,
            		renderColor:"[124,252,0,0.8]",
            		condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.JCHFL3.template,
            		GZLX:"旧城镇",
            		table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"旧城镇"
            		}
            	},
                "国有储备用地":{
                	url:mapinfoTemplate.JHGD.layerurl,
                	id:"stateownedReserve_advQuery",
                	queryFild:mapinfoTemplate.JHGD.queryFild,
                	queryFildValue:mapinfoTemplate.JHGD.queryFildValue,
                	areaField:mapinfoTemplate.JHGD.areaField,
//                	tableName:"SDDCGISDATA.JHGD",
                	tableName:mapinfoTemplate.JHGD.tableName,
            		renderColor:"[123,104,238,0.8]",
                	condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.JHGD.template,
            		table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"国有储备用地"
            		},
                },
                "纳入三旧的旧村":{
                	url:mapinfoTemplate.JCUFL3.layerurl,
                	id:"threeOldVillage_advQuery",
                	queryFild:mapinfoTemplate.JCUFL3.queryFild,
                	queryFildValue:mapinfoTemplate.JCUFL3.queryFildValue,
                	areaField:mapinfoTemplate.JCUFL3.areaField,
//                	tableName:"SDDCGISDATA.JCU",
                	tableName:mapinfoTemplate.JCUFL3.tableName,
                	renderColor:"[50,205,50,0.8]",
                	condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.JCUFL3.template,
            		GZLX:"旧村庄",//这个需要有
        			table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"旧村庄"
            		}
                },
                "纳入三旧的集体旧厂":{
                	url:mapinfoTemplate.JCFFL3.layerurl,
                	id:"threeOldCollFactory_advQuery",
                	queryFild:mapinfoTemplate.JCFFL3.jt_queryFild,
                	queryFildValue:mapinfoTemplate.JCFFL3.jt_queryFildValue,
                	areaField:mapinfoTemplate.JCFFL3.jt_areaField,
//            		tableName:"SDDCGISDATA.JCF",
            		tableName:mapinfoTemplate.JCFFL3.tableName,
                	renderColor:"[20,25,147,0.8]",
                	condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.JCFFL3.template,
            		table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"集体旧厂"
            		}
                },
                "村自留地":{
                	url:mapinfoTemplate.LYD.layerurl,
                	id:"villagePlots_advQuery",
                	queryFild:mapinfoTemplate.LYD.queryFild,
                	queryFildValue:mapinfoTemplate.LYD.queryFildValue,
                	areaField:mapinfoTemplate.LYD.areaField,
//            		tableName:"SDDCGISDATA.LYD",
            		tableName:mapinfoTemplate.LYD.tableName,
                	renderColor:"[30,144,255,0.8]",
                	condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.LYD.template,
            		table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"留用地"
            		}
                },
                "控规":{
                	url:mapinfoTemplate.KG.layerurl,
                	id:"regulatoryPlan_advQuery",
                	queryFild:mapinfoTemplate.KG.queryFild,
                	queryFildValue:mapinfoTemplate.KG.queryFildValue,
                	areaField:mapinfoTemplate.KG.areaField,
//                	tableName:"SDDCGISDATA.KG",
                	tableName:mapinfoTemplate.KG.tableName,
                	renderColor:"[0,0,255,1]",
                	condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.KG.template,
            		table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"控规"
            		}
                },
                "土规":{
                	url:mapinfoTemplate.TG.layerurl,
                	id:"soilPlanning_advQuery",
                	queryFild:mapinfoTemplate.TG.queryFild,
                	queryFildValue:mapinfoTemplate.TG.queryFildValue,
                	areaField:mapinfoTemplate.TG.areaField,
//                	tableName:"SDDCGISDATA.TG",
                	tableName:mapinfoTemplate.TG.tableName,
                	renderColor:"[255,215,0,1]",
                	condition:"",
            		filterLayer:null,
            		templateInfo:mapinfoTemplate.TG.template,
            		table:{
            			"tabelData":null,
        				"columnsData":null,
        				"sortName":"CODE",
        				"sortOrder":"asc",
        				"exportTableName":"土规"
            		}
                }
            },
            //创建高级查询的要素图层时需要的条件
            this.createFeatureLayerCondition={layerUrl:"",layerId:"",condition:"",templateInfo:"",render:null}
        },
        //初始化
        init:function (){
        	//设置对话框的宽度
        	$(this.domNode).closest('.dialogContainer').css('width','735px');
        	
        	//为搜索按钮绑定单击事件
        	on(this.frontHeatDiagramSearch,"click",lang.hitch(this,this._frontHeatDiagramSearch));
        	
        	//为关闭按钮绑定单击事件
        	on(this.frontHeatDiagramCloseBtn,"click",lang.hitch(this,this._frontHeatDiagramCloseSearch));
        	
        	Topic.subscribe("mutiLandType_AdvQuery",dojo.hitch(this,this._mutiAdvQueryLandType));
        	//发布一个方法:根据ObjectID查询地块的方法
            Topic.subscribe("queryBlockById_AdvQuery",dojo.hitch(this,this._queryBlockById));
            
            //为土地类型文本框赋值
            this.selMutilLandTypeNode=false;
            Topic.subscribe("selMutilLandTypeNode_AdvQuery",dojo.hitch(this,function(){
            	debugger
            	this.selMutilLandTypeNode=true;
            	$('#frontHeatDiagramTbody tr:not(:first-child)',this.domNode).remove();
            }));
            Topic.subscribe("selSingleLandTypeNode_AdvQuery",dojo.hitch(this,function(){
            	debugger
            	this.selMutilLandTypeNode=false;
            }));
            
            this._formValidate();//初始化表单验证
            
           // this._scrollListenerEvent();
        },
        //添加事件
        addEvents:function(rowIndex){
        	this.bindOperaBtnEvt(rowIndex);
        	this.bindConditionChangeEvt(rowIndex);
        },
        startup:function(){
            this.inherited(arguments);
        },
        //关闭对话框
        closeDialog:function(){
			$(this.domNode).hide();
		},
		/*******************动态增加行和删除行********************************************/
		//新增行
		_plusRow:function(e){
			if(!$('#advQueryFormId').valid()){
				Arcdialog.tips('有信息未填写,不允许新增行!',Math.ceil(document.body.clientWidth)/2-75,80,150,50,1);
				return false;
			}else{
				debugger
				var currentRowIndex = $(e.currentTarget).closest('tr').index();
				var currentRow = query('#frontHeatDiagramTbody > tr',this.domNode)[currentRowIndex];
				var landType =  $('select.landType',currentRow).val();
				//此时就要做限制:土地类型只能选择一次、土规只能选择一次、控规可以选择多次
				var rowTemplate= $(this.rowTemplate).clone()[0];
				if(currentRowIndex == 0){
					if(landType != 'TDLX'){
						Arcdialog.tips('多条件查询第一个条件必须选择土地类型!',Math.ceil(document.body.clientWidth)/2-100,80,200,50,1);
						return;
					}else{
						if(this.selMutilLandTypeNode){
							Arcdialog.tips('要进行多条件查询，土地类型的值只能选择一个!',Math.ceil(document.body.clientWidth)/2-100,80,200,50,1);
							return;
						}else{
							$('select.landType > option[value="TDLX"]',rowTemplate).remove();
						}
					}
				}else{
					 if(landType == 'TG'){
						$('select.landType > option[value="TG"]',rowTemplate).remove();
					 }
				}
				this.rowTemplate = rowTemplate;
			    $('input.inputItem',rowTemplate).val("");
			    debugger
			    domConstruct.place(rowTemplate, currentRow, "after");
			    //修改元素的name属性
			    this.addEvents(currentRowIndex+1);//为复制的元素绑定事件
			}
		},
		//删除行
		_subRow:function(e){
			console.info("删除行");
			var currentRowIndex = $(e.currentTarget).closest('tr').index();
			if(currentRowIndex == 0){
				alert("已经最后一个了,不能删除！");
			}else{
				var currentRow = query('#frontHeatDiagramTbody > tr',this.domNode)[currentRowIndex];
				currentRow.remove();
				
				//控制土地类型中的元素内容,在点击删除按钮的时候
				var rowTemplate= $(this.rowTemplate).clone()[0];
				var landType =  $('select.landType',currentRow).val();
				if(landType == 'TDLX'){
					$('select.landType',rowTemplate).append('<option value="TDLX">土地类型</option>');
				}else if(landType == 'TG'){
					$('select.landType',rowTemplate).append('<option value="TG">土规</option>');
				}
				this.rowTemplate=rowTemplate;
			}
		},
		//为增加按钮和减少按钮绑定事件
		bindOperaBtnEvt:function(rowIndex){
			var rowElm = query('#frontHeatDiagramTbody > tr',this.domNode)[rowIndex];
        	var plusRowElm = $('div.plusRow',rowElm)[0];
        	var subRowElm =  $('div.subRow',rowElm)[0];
			on(plusRowElm,"click",lang.hitch(this,this._plusRow));
        	on(subRowElm,"click",lang.hitch(this,this._subRow));
		},
		bindConditionChangeEvt:function(rowIndex){
			debugger
			var rowElm = query('#frontHeatDiagramTbody > tr',this.domNode)[rowIndex];
			$('.inputItem',rowElm).replaceWith('<input type="text" class="form-control inputItem" name="inputItem'+rowIndex+'" value="" placeholder="请选择..." style="width:150px;">');
			var landType = $('select.landType',rowElm);
			landType.attr("name","landType"+rowIndex);
			this._addValidateInfo(rowIndex);//添加验证信息
			landType.change(function(e){
				//特殊处理---针对第一行  如果这个改变的话,如果存在多行，就将下面的行移除掉
				debugger
				if(rowIndex === 0){
					if(query('#frontHeatDiagramTbody > tr',this.domNode).length > 1){
						$('#frontHeatDiagramTbody > tr:not(:first-child)',this.domNode).remove();
						this.rowTemplate=query('#frontHeatDiagramTbody > tr',this.domNode)[0];//因为在点击加上的时候,就已经将this.rowTemplate修改了,所以需要将模板恢复过来
					}
				}
				debugger
				var rowElm = query('#frontHeatDiagramTbody > tr',this.domNode)[rowIndex];
				var value = e.currentTarget.value;
				var  inputItem = $('.inputItem',rowElm);
				if(value == "TG"){
					debugger
					//input换为简单的select
					var select = '<select class="form-control inputItem" name="inputItem'+rowIndex+'" style="width:150px;">';
					select += '<option value="">请选择</option>';
					select += '<option value="建设用地">建设用地</option>';
					select += '<option value="非建设用地">非建设用地</option>';
					select += '</select>';
					inputItem.replaceWith(select);
					debugger
					$('select.inputItem', rowElm).change(function (){
				    	debugger
				    	if($("#advQueryFormId").validate().element($(this))){
				    		$(this).parent().removeClass('has-error');
				    	}
				    });
				}else if(value == "KG"){
					debugger
					var select='<select class="form-control inputItem" name="inputItem'+rowIndex+'" style="width:150px;">';
					select += '<option value="">请选择</option>';
					select += '<option value="居住用地">居住用地</option>';
					select += '<option value="商业用地">商业用地</option>';
					select += '<option value="公服设施用地">公服设施用地</option>';
					select += '<option value="工业及仓储用地">工业及仓储用地</option>';
					select += '<option value="其他用地">其他用地</option>';
					select += '</select>';
					inputItem.replaceWith(select);
					$('select.inputItem', rowElm).change(function (){
				    	if($("#advQueryFormId").validate().element($(this))){
				    		$(this).parent().removeClass('has-error');
				    	}
				    });
				    /* 文本输入框模糊查询*/
				}else if(value == "TDLX"){
					var input='<input type="text" class="form-control inputItem" value="" name="inputItem'+rowIndex+'" placeholder="请选择..." style="width:150px;">';
					inputItem.replaceWith(input);
					inputItem = $('.inputItem',rowElm);
					debugger
					//此时需要给后面的input绑定获取焦点的事件
					inputItem.focus(function(){
						debugger
						require(["gistech/widgets/LandResTree/LandResTree",], function (LandResTree){
							debugger
		        		 	var landResTree = new LandResTree({pos:{l:Math.ceil(document.body.clientWidth)/2-419,t:84},"landTypeItem":inputItem,"formId":"#advQueryFormId"},dojo.byId("dialog"));
		        		 	landResTree.setTitle("土地资源树图表");
		        	 	 	landResTree.startup();
		        	   });
					}.bind(this));
				}
				debugger
				
			}.bind(this));
		},
		/******************广东省包含的城市+区县的二级联动**************************************/
		_reConstructDsy:function(){
			this.userPermission.city={};
			if(this.userPermission.data.length>0){
				if(ioc.map.userInfoData.isManager){//管理员
					this.userPermission.city=dsy.Items["0"];
				}else{//非管理员
					 array.forEach(this.userPermission.data,lang.hitch(this,function(item){
						for(var key in dsy.Items){
							 if(key != "0"){
								 var position = array.indexOf(dsy.Items[key], item);
								 if(position != -1){
									 var city=dsy.Items["0"][key.split("_")[1]];
									 
									 if(this.userPermission.city[city] == undefined){
										 this.userPermission.city[city]={"county":[]};
									 }
									 this.userPermission.city[city]["county"].push(item);
									 break;
								 }
							 }
						 }
					}));
					 debugger
					 dsy.Items={};
					 var count=0;
					 for(var key in this.userPermission.city){
						 if(dsy.Items["0"] == undefined){
							 dsy.Items["0"]=[];
						 }
						 dsy.Items["0"].push(key);
						 dsy.Items["0_"+count]=this.userPermission.city[key]["county"];
						 count++;
					 }
					 debugger
				}
			}
		},
		_init_area:function(){
			for(var i=0;i<this.s.length-1;i++){
			    (function(i){
    				$("#"+this.s[i],this.domNode).change(function(){
    					this._change(i+1);
    				}.bind(this));
				}.bind(this))(i);
          	}
          	this._change(0);
		},
		_change:function(v){
			var str="0";
			for(i=0;i<v;i++){
				str+=("_"+($("#"+this.s[i],this.domNode)[0].selectedIndex-1));
			};
			var ss=$("#"+this.s[v],this.domNode)[0];
			with(ss){
				length = 0;
				options[0]=new Option(this.opt0[v],"");
				if(v && $("#"+this.s[v-1],this.domNode)[0].selectedIndex>0 || !v){
					if(dsy.Exists(str)){
						ar = dsy.Items[str];
						for(i=0;i<ar.length;i++){
							options[length]=new Option(ar[i],ar[i]);
						}//end for
						if(v){ options[0].selected = true;}
					}
				}//end if v
				if(++v<this.s.length){this._change(v);}
			}//End with
		},
		/********************带搜索的下拉框*****************************/
		/************************点击搜索，进行条件的拼接***************************************************/
		_frontHeatDiagramCloseSearch:function(){
			this.closeDialog();
		},
		_frontHeatDiagramSearch:function(){
			debugger
			if(!$('#advQueryFormId').valid()){//表单验证不通过
				return false;
			}else{//表单验证通过
				debugger
				this._specialZoneToMap();
				this._getSearchCon();
			    this._serviceLayerInsert();
			}
		},
		//高级查询表单验证
		_formValidate:function(){
			debugger
			$('#advQueryFormId').validate({
			 	errorElement: 'label',
		        errorClass: 'has-error',
		        focusInvalid: true,
		        rules:{
		        	's_city': {required: true},
		        	's_county':{required: true}
		        },
			    messages:{
			    	's_city': {required: ""},
		        	's_county':{required: ""}
			    },
		        errorPlacement: function (error, element) {
	                 element.parent().addClass(this.errorClass);
	                 element.removeClass(this.errorClass);
	            }
			});
			$('select#s_city', this.domNode).change(function (){
		    	debugger
		    	if($("#advQueryFormId").validate().element($(this))){
		    		$(this).parent().removeClass('has-error');
		    	}
		    });
			$('select#s_county', this.domNode).change(function (){
		    	debugger
		    	if($("#advQueryFormId").validate().element($(this))){
		    		$(this).parent().removeClass('has-error');
		    	}
		    });
		},
		//补充添加验证信息
		_addValidateInfo:function(rowIndex){
			this._dsyAddValidateRules(rowIndex);
		},
		//添加验证规则
		_dsyAddValidateRules:function(rowIndex){
			debugger
			var $row=query('#frontHeatDiagramTbody > tr',this.domNode)[rowIndex];
			$('select.landType',$row).rules("add", { required: true, messages: { required: ""}});
			$('.inputItem',$row).rules("add", { required: true, messages: { required: ""}});
			$('select.landType', $row).change(function (){
		    	if($("#advQueryFormId").validate().element($(this))){
		    		$(this).parent().removeClass('has-error');
		    	}
		    });
		},
		/**
		 * 根据选择区域将地图定位到相应的地图范围
		 */
		_specialZoneToMap:function(){
			debugger
			var county=$('#s_county',this.domNode).val();
			require(["gistech/util/CityDistCenters"], lang.hitch(this,function(CityDistCenters){
           		var cityDistCenters = new CityDistCenters();
           		cityDistCenters.startup();
           		for(var i=0;i<ioc.map.qufeatures.length;i++){
           			if(ioc.map.qufeatures[i].name==county){
           				this.map.centerAndZoom(ioc.map.qufeatures[i].point,9);
           				break;
           			}
           		}
         	}));
		},
		/**
		 * 获取高级查询的条件
		 */
		_getSearchCon:function(){
			this.searchCon.dist={county:[]};
			this.searchCon.area={startValue:"",endValue:""};
			this.searchCon.TDLXCon=[];
			this.searchCon.KGCon=[];
			this.searchCon.TGCon=[];
			//获取区域值
			var countyValue =  $('div.searchCondition #s_county',this.domNode).val();
			if(countyValue != "区/县"){
				this.searchCon.dist.county.push(countyValue);
			}
			//获取面积值
			var beginValue = $('div.searchCondition #startValue',this.domNode).val();
		    var endValue = $('div.searchCondition #endValue',this.domNode).val();
		    if(beginValue!="" && endValue == ""){
		    	if(parseInt(beginValue)<10){
		    		beginValue="10";
		    	}
		    	this.searchCon.area.startValue=beginValue;
		    }else if(beginValue =="" && endValue != ""){
		    	this.searchCon.area.startValue="10";
		    	this.searchCon.area.endValue=endValue;
		    }else if(beginValue !="" && endValue != ""){
		    	if(parseInt(beginValue)<10){
		    		beginValue="10";
		    	}
		    	this.searchCon.area.startValue=beginValue;
		    	this.searchCon.area.endValue=endValue;
		    }else{
		    	this.searchCon.area.startValue="10";
		    }
			//拼接搜索的条件
		    var condition="";
			var rowsElm = query('#frontHeatDiagramTbody > tr',this.domNode);
			for(var i=0;i<rowsElm.length;i++){
				var rowElm = rowsElm[i];
				var $landType = $('select.landType',rowElm);
				var $arithSym= $('input.arithSym',rowElm);
				var $inputItem = $('.inputItem',rowElm);
				var $logicSym= $('input.logicSym',rowElm);
				if($landType.val() == "TDLX"){
					if($inputItem.val()!=""){
						if($inputItem.val().indexOf("...")!=-1){
		        			if($inputItem[0].title.replace(/\s/g,"").indexOf(",")!=-1){
		        				this.searchCon.TDLXCon=$inputItem[0].title.replace(/\s/g,"").split(",");
		        			}else{
		        				this.searchCon.TDLXCon.push($inputItem[0].title.replace(/\s/g,""));
		        			}
		        		}else{
		        			if($inputItem.val().replace(/\s/g,"").indexOf(",")!=-1){
		        				this.searchCon.TDLXCon=$inputItem.val().replace(/\s/g,"").split(",");
		        			}else{
		        				this.searchCon.TDLXCon.push($inputItem.val().replace(/\s/g,""));
		        			}
		        		}
					}
				}else if($landType.val()  == "TG"){
					this.searchCon.TGCon.push($inputItem.val());
				}else if($landType.val()  == "KG"){
					this.searchCon.KGCon.push($inputItem.val());
				}
			}
		},
		/**
		 * 实现图层要素的高级查询
		 */
		_serviceLayerInsert:function(){
			debugger
			$("#wrapper").showLoading();
			//清楚所有的土地类型图层
			this._clearConditionAndLayerObj();
			var noEmptyArr=[];
			for(var key in this.searchCon){
				if(this.searchCon[key] instanceof Array){
					if(this.searchCon[key].length != 0){
						noEmptyArr.push(key);
					}
				}
			}
			if(noEmptyArr.length == 1){//单条件
				switch(noEmptyArr[0]){
					case "TDLXCon":
						debugger
						this.onlylandTypeCount=0;
						if(this.searchCon[noEmptyArr[0]].length>1){
							Global.widgets.right.removeAllTab();
							var columnArr=[
							   {field:'ID',title:'编号',width:30,align:'center'},
							   {field:'LANDTYPENAME',title:'土地类型',width:30,align:'center'},
							   {field:'CSMC',title:'市',width:40,align:'center'},
				               {field:'FQMC',title:'区/县', width:30,align:'center'}
					        ];
							var dataArr=[];
							for(var i=0 ; i<this.searchCon["TDLXCon"].length;i++){
								var obj={};
								obj["ID"] = i+1;
								obj["LANDTYPENAME"]=this.searchCon["TDLXCon"][i];
								obj["CSMC"]=$('#s_city',this.domNode).val();
								obj["FQMC"]=$('#s_county',this.domNode).val();
								dataArr.push(obj);
							}
							//创建表格
							require(["gistech/widgets/QueryTableList/QueryTableList"],lang.hitch(this,function(QueryTableList){
								var queryTableList = new QueryTableList({
									"tableData":dataArr,
									"columnsData":columnArr,
									"sortName":"ID",
									"sortOrder":'asc'
								});
								queryTableList.$table.bootstrapTable('refreshOptions',{detailView:false,search:false,showExport:false,showToggle:false});
								queryTableList.startup();
								$('.fixed-table-toolbar',queryTableList.domNode).css({"height":"42px","background-color":"#f5f5f5","margin-bottom":"5px","padding-top":"10px","border-radius": "4px","margin-top": "6px"});
								var headHTML='<span style="font-size: 16px;padding-left: 10px;">土地类型列表</span>';
								domConstruct.place(headHTML, $('.fixed-table-toolbar',queryTableList.domNode)[0], "first");
								$('.fixed-table-toolbar .columns',queryTableList.domNode).css({"margin-top":"-5px","margin-right":"10px"});
								$('.fixed-table-container .pagination-detail',queryTableList.domNode).css("display","none");
								
								$('tbody>tr:nth-child(1)',queryTableList.domNode).css("backgroundColor","#fffccc").unbind();
								queryTableList.selRow.selRowElement=$('tbody>tr:nth-child(1)',queryTableList.domNode);
								
								var panel = new ContentPane();
								$(panel.domNode).wrapInner(queryTableList.domNode);
								Global.widgets.right.addTab(panel);
							}));
							array.forEach(this.searchCon[noEmptyArr[0]], lang.hitch(this,function(item){
								this._conFeatureFilter(item,null);
							}));
						}else{
							this._conFeatureFilter(this.searchCon[noEmptyArr[0]][0],null);
						}
						break;
					case "KGCon":
						this._conFeatureFilter("控规",null);
						break;
					case "TGCon":
						this._conFeatureFilter("土规",null);
						break;
				}
			}else{//多条件
				this._mutilConAdvQuery(noEmptyArr);
			}
		},
		//多条件查询
		_mutilConAdvQuery:function(noEmptyArr){
			var params = this._constructParamObj(noEmptyArr);
			$.post("../client/service/advQueryController/advQuery",{"params":JSON.stringify(params)},function(resp){
				debugger
				var resp= $.parseJSON(resp)
				if(resp.success){
					//var condition=this._constructCondition(resp.result);
					this._conFeatureFilter(this.searchCon["TDLXCon"][0],resp.result);
				}else{
					if(resp.result.message.indexOf("SQL Error")!=-1){
						layer.msg("请求SQL出错，请联系管理员！", {
							icon : 2,time:3000
						});
					}else{
						layer.msg("查询异常，请重试！", {
							icon : 2,time:3000
						});
					}
					$("#wrapper").hideLoading();
					return;
				}
			}.bind(this));
		},
		//清空条件和图层对象变量
		_clearConditionAndLayerObj:function(){
			for(var i in this.showLayer){
				if(this.showLayer[i]["filterLayer"] != null){
					this.showLayer[i]["condition"]="";
					this.showLayer[i]["filterLayer"].clear();
				}
			}
		},
		//真正实现图层要素的查询（单条件+多条件）
		_conFeatureFilter:function(landTypeName,respData){
			this.createFeatureLayerCondition.layerUrl=this.showLayer[landTypeName].url;
			this.createFeatureLayerCondition.layerId=this.showLayer[landTypeName].id;
			var condition="";
			
			if(landTypeName=="控规"){//控规
				for(var i=0;i<this.searchCon.KGCon.length;i++){
					//固定条件
					if(i == (this.searchCon.KGCon.length-1)){
						condition += this.showLayer["控规"].queryFild +"="+"'"+this.searchCon.KGCon[i]+"'";
					}else{
						condition += this.showLayer["控规"].queryFild +"="+"'"+this.searchCon.KGCon[i]+"' or ";
					}
				};
			}else if(landTypeName=="土规"){//土规
				condition = this.showLayer["土规"].queryFild +"="+"'"+this.searchCon.TGCon[0]+"'";
//			}else if(landTypeName == '纳入三旧的旧厂' || landTypeName == '纳入三旧的旧城'){
//				condition = this.showLayer[landTypeName].queryFild +"='国有用地'";
//			}else if(landTypeName == '纳入三旧的旧村' || landTypeName == '纳入三旧的集体旧厂'){
//				condition = this.showLayer[landTypeName].queryFild +"='集体用地'";
//			}else{
//				condition="1=1";
//			}
			}else if(landTypeName == '纳入三旧的旧厂' || landTypeName == '纳入三旧的旧城'||landTypeName == '纳入三旧的旧村' || landTypeName == '纳入三旧的集体旧厂'){
				condition = this.showLayer[landTypeName].queryFild +"='"+this.showLayer[landTypeName].queryFildValue+"'";
			}else{
				condition="1=1";
			}	
			condition += this._disctCondition();//区域的条件 
			condition += this._areaCondition(landTypeName);//面积条件
			if(respData != null && respData.length>0){
				condition += this._constructCondition(respData);
			}
			this.createFeatureLayerCondition.condition=this.showLayer[landTypeName].condition=condition;
			this.createFeatureLayerCondition.render=new LandTypeRenderer({config:{color:this.showLayer[landTypeName].renderColor}});
			this.createFeatureLayerCondition.templateInfo= this.showLayer[landTypeName].templateInfo;
			
			this._createFeatureLayerWithFilter(landTypeName,respData);
		},
		//多条件查询传递的参数拼接
		_constructParamObj:function(noEmptyArr){
			debugger
			var rowsElm = query('#frontHeatDiagramTbody > tr',this.domNode);
			var mainBody=$('select.landType',rowsElm[0]).val();
			var param={
				"mainBody":mainBody,
				"county":this.searchCon.dist.county[0],
				"area":{"startValue":this.searchCon.area.startValue,"endValue":this.searchCon.area.endValue},
				"landTypeFlag":false,
				"KGFlag":false,
				"TGFlag":false
			};
			array.forEach(noEmptyArr, lang.hitch(this,function(item){
			     switch(item){
			     	case "TDLXCon":
			     		param["landType"]=this.searchCon[item][0];
				     	param["landTypeTable"]=this.showLayer[this.searchCon[item][0]]["tableName"];
				     	param["landTypeQueryField"]=this.showLayer[this.searchCon[item][0]]["queryFild"];
				    	param["landTypeAreaField"]=this.showLayer[this.searchCon[item][0]]["areaField"];
				     	param["landTypeFlag"]=true;
				     	break;
			     	case "KGCon":
			     		param["KG"]=this.searchCon[item];
			     		param["KGTable"]=this.showLayer["控规"]["tableName"];
			     		param["KGQueryField"]=this.showLayer["控规"]["queryFild"];
			     		param["KGFlag"]=true;
			     		break;
			     	case "TGCon":
			     		param["TG"]=this.searchCon[item];
			     		param["TGTable"]=this.showLayer["土规"]["tableName"];
			     		param["TGQueryField"]=this.showLayer["土规"]["queryFild"];
			     		param["TGFlag"]=true;
			     		break;
			     }
			}));
			return param;
		},
		//多条件查询条件的构造
		_constructCondition:function(responseData){
			debugger
			var condition=' AND OBJECTID in (';
			debugger
			for(var i=0;i<responseData.length;i++){
				if(i == responseData.length-1){
					condition += parseInt(responseData[i].OBJECTID);
				}else{
					condition += parseInt(responseData[i].OBJECTID)+',';
				}
			}
			condition+=')';
			return condition;
		},
		//区域查询条件的构建
		_disctCondition:function(){
			var condition="";
			if(this.searchCon.dist.county.length!=0){
				condition +=" and FQMC in(";
				for(var i=0 ; i< this.searchCon.dist.county.length;i++){
					if(i != (this.searchCon.dist.county.length-1)){
						condition+="'"+this.searchCon.dist.county[i]+"',";
					}else{
						condition+="'"+this.searchCon.dist.county[i]+"')";
					}
				}
			}
			return condition;
		},
		//面积查询条件的构建
		_areaCondition:function(landTypeName){
			/*var field="YDMJ";
			if(landTypeName == "村自留地"){
				field="MJ";
			}*/
			var field=this.showLayer[landTypeName]["areaField"];
			var condition="";
			if(this.searchCon.area.startValue !="" || this.searchCon.area.endValue != ""){
				if(this.searchCon.area.startValue !="" && this.searchCon.area.endValue == ""){
					condition+=" and "+field+" >="+ parseFloat(this.searchCon.area.startValue);
				}else if(this.searchCon.area.startValue =="" && this.searchCon.area.endValue != ""){
					condition+=" and "+field+" <="+ parseFloat(this.searchCon.area.endValue);
				}else if(this.searchCon.area.startValue !="" && this.searchCon.area.endValue != ""){
					condition+=" and "+field+" >="+ parseFloat(this.searchCon.area.startValue);
					condition+=" and "+field+" <="+ parseFloat(this.searchCon.area.endValue);
				}
			}
			return condition;
		},
		//创建要素图层
		_createFeatureLayerWithFilter:function(landTypeName,respData){
			debugger
			//过滤要素图层的方式1
			//清空所有的filterLayer
			if(this.showLayer[landTypeName].filterLayer==null){
				this.showLayer[landTypeName].filterLayer = new GraphicsLayer({
					id:this.createFeatureLayerCondition.layerId,
//					infoTemplate:new InfoTemplate(this.createFeatureLayerCondition.templateInfo);
				});
				//存储所有graphic图层
				ioc.map.graphiclayers.push(this.showLayer[landTypeName].filterLayer);
				this.showLayer[landTypeName].filterLayer.setRenderer(this.createFeatureLayerCondition.render);
				this.map.addLayer(this.showLayer[landTypeName].filterLayer);
				on(this.showLayer[landTypeName].filterLayer,"click",lang.hitch(this,function(e){
					Topic.publish("graphicClickEvent",e);
				}));
			}else{
				this.showLayer[landTypeName].filterLayer.clear();
			}
			//过滤要素图层的方式2
			debugger
			var queryTask=new QueryTask(this.createFeatureLayerCondition.layerUrl);
			var query=new ArcQuery();
			query.returnGeometry=true;
			query.outFields=["*"];
			query.where=this.createFeatureLayerCondition.condition;
			queryTask.execute(query,lang.hitch(this,function(feaset){
				debugger
				for(var i=0;i<feaset.features.length;i++){
					feaset.features[i].fields=feaset.fields;
					this.showLayer[landTypeName].filterLayer.add(feaset.features[i]);
				}
				this._LandTypeColumnData(landTypeName);
				this._LandTypeData(feaset.features,landTypeName);
				if(this.searchCon.TDLXCon.length>1){//单条件且土地类型是多个的情况
					this.onlylandTypeCount++;
					if(this.onlylandTypeCount == this.searchCon.TDLXCon.length){
						this._createAdvQueryTableList(this.searchCon.TDLXCon[0]);
					}
				}else{
					this._createAdvQueryTableList(landTypeName);
				}
			}));
		},
		//创建土地类型列数据
		_LandTypeColumnData:function(landTypeName){
			var arr=[
			           {field:'OBJECTID',title:'编号',width:30,visible:false},
	  				   {field:'CODE',title:'要素代码',width:30,align:'center',sortable:false},
	                   {field:'CSMC',title:'市',width:45,align:'center',visible:false},
	                   {field:'FQMC',title:'区/县', width:30,align:'center',visible:false}];
			switch(landTypeName){
				case "纳入三旧的旧厂":
				case "纳入三旧的旧城":
					var JCJCArr=[
							    {field:'ZJMC',title:'镇街名称',width:30,align:'center',visible:true},
							    {field:'ZLDWMC',title:'座楼单位名称',width:30,align:'center',visible:true}, 
							    {field:'GYMJ',title:'用地面积',width:30,align:'center'},
							    {field:'QSDWMC',title:'权属单位',width:30,align:'center'},
							    
							    {field:'XMDKBH',title:'图斑编号',width:30,align:'center',visible:false}, 
							    {field:'GZLX',title:'改造类型',width:30,align:'center',visible:false},
							    {field:'SYQSX',title:'所有权属性',width:30,align:'center',visible:false},
							    {field:'TDYT',title:'现土地用途',width:30,align:'center',visible:false},
							    {field:'GHYT',title:'规划用途',width:30,align:'center',visible:false},
							    {field:'NGZYT',title:'拟改造用途',width:30,align:'center',visible:false},
							    {field:'SFBZGH',title:'是否规划',width:30,align:'center',visible:false},
							    {field:'GYMJ',title:'其中国有面积',width:30,align:'center',visible:false},
							    {field:'JTMJ',title:'其中集体面积',width:30,align:'center',visible:false},
							    {field:'NYDMJ',title:'其中农用地面积',width:30,align:'center',visible:false},
							    {field:'HFYDMJ',title:'其中合法用地面积',width:30,align:'center',visible:false},
							    {field:'JHGZNF',title:'计划改造年份',width:30,align:'center',visible:false},
							    {field:'BZ',title:'备注',width:30,align:'center',visible:false},
							    {field:'BZ2',title:'标注',width:30,align:'center',visible:false},
							    {field:'JCFNF',title:'旧村庄年份',width:30,align:'center',visible:false}
							];
							arr	= arr.concat(JCJCArr);
							break;
				case "纳入三旧的旧村":
				case "纳入三旧的集体旧厂":
					var SJArr=[
					    {field:'ZJMC',title:'镇街名称',width:30,align:'center',visible:true},
					    {field:'ZLDWMC',title:'座楼单位名称',width:30,align:'center',visible:true}, 
					    {field:'JTMJ',title:'用地面积',width:30,align:'center'},
					    {field:'QSDWMC',title:'权属单位',width:30,align:'center'},
					    
					    {field:'XMDKBH',title:'图斑编号',width:30,align:'center',visible:false}, 
					    {field:'GZLX',title:'改造类型',width:30,align:'center',visible:false},
					    {field:'SYQSX',title:'所有权属性',width:30,align:'center',visible:false},
					    {field:'TDYT',title:'现土地用途',width:30,align:'center',visible:false},
					    {field:'GHYT',title:'规划用途',width:30,align:'center',visible:false},
					    {field:'NGZYT',title:'拟改造用途',width:30,align:'center',visible:false},
					    {field:'SFBZGH',title:'是否规划',width:30,align:'center',visible:false},
					    {field:'GYMJ',title:'其中国有面积',width:30,align:'center',visible:false},
					    {field:'JTMJ',title:'其中集体面积',width:30,align:'center',visible:false},
					    {field:'NYDMJ',title:'其中农用地面积',width:30,align:'center',visible:false},
					    {field:'HFYDMJ',title:'其中合法用地面积',width:30,align:'center',visible:false},
					    {field:'JHGZNF',title:'计划改造年份',width:30,align:'center',visible:false},
					    {field:'BZ',title:'备注',width:30,align:'center',visible:false},
					    {field:'BZ2',title:'标注',width:30,align:'center',visible:false},
					    {field:'JCFNF',title:'旧村庄年份',width:30,align:'center',visible:false}
					];
					arr	= arr.concat(SJArr);
					break;
				case "村自留地":
					var lydArr=[//留用地
					    {field:'ZJMC',title:'镇街名称',width:30,align:'center',visible:true},
					    {field:'CMC',title:'村（社区）名称',width:30,align:'center',visible:true},
					    {field:'MJ',title:'面积',width:30,align:'center',visible:true},
					    {field:'QSDW',title:'权属单位',width:30,align:'center'},
					   
					    {field:'SYQXZ',title:'所有权性质',width:30,align:'center',visible:false},
					    {field:'XZYT',title:'现状用途',width:30,align:'center',visible:false},
					    {field:'DZ',title:'地址',width:30,align:'center',visible:false},
					    {field:'WH',title:'选址文号',width:30,align:'center',visible:false},
					    {field:'PWH',title:'土地发证文号',width:30,align:'center',visible:false},
					    {field:'BZ',title:'备注',width:30,align:'center',visible:false},
					    {field:'BZ2',title:'标注',width:30,align:'center',visible:false}
					];
					arr	= arr.concat(lydArr);
					break;
				case "国有储备用地":
					var jhgdArr=[//国有储备用地
					             {field:'ZJMC',title:'镇街名称',width:30,align:'center'},
					             {field:'YDMJ',title:'用地面积',width:30,align:'center'},
					             {field:'SJMC',title:'市界名称',width:30,align:'center',visible:false},
					             {field:'QJMC',title:'区界名称',width:30,align:'center',visible:false},
					             {field:'BZ',title:'备注',width:30,align:'center',visible:false},
					             {field:'BZ2',title:'标注',width:30,align:'center',visible:false}
					];
					arr	= arr.concat(jhgdArr);
					break;
				case "控规":
					var kgArr=[//控规
					   {field:'ZJMC',title:'镇街名称',width:30,align:'center'},
					   {field:'YDMJ',title:'用地面积', width:30,align:'center'},
			           {field:'KGFLDL',title:'控规分类大类', width:30,align:'center',visible:false},
			           {field:'KGFLZL',title:'控规分类中类', width:30,align:'center',visible:false},
			           {field:'KGFLXL',title:'控规分类小类', width:30,align:'center',visible:false},
			           {field:'BZ',title:'备注', width:30,align:'center',visible:false},
			           {field:'BZ2',title:'标注', width:30,align:'center',visible:false}
			        ];
					arr	= arr.concat(kgArr);
					break;
				case "土规":
					var tgArr=[//土规
					   {field:'YDMJ',title:'用地面积', width:30,align:'center'},
			           {field:'TGFLDL',title:'土规分类大类', width:30,align:'center'}
			        ];
					arr	= arr.concat(tgArr);
					break;
			}
			this.showLayer[landTypeName]["table"]["columnsData"]=arr;
		},
		//创建土地类型行数据
		_LandTypeData:function(objArr,landTypeName){
			debugger
			var arr=[];
			for(var i=0;i<objArr.length;i++){
				var obj={};
				obj["OBJECTID"] = objArr[i].attributes.OBJECTID;
				obj["CODE"] = objArr[i].attributes.CODE;
				obj["CSMC"] = objArr[i].attributes.CSMC;
				obj["FQMC"] = objArr[i].attributes.FQMC;
				switch(landTypeName){
					case "纳入三旧的旧厂":
					case "纳入三旧的旧城":
						obj["ZJMC"] = objArr[i].attributes.ZJMC;
						obj["ZLDWMC"] = objArr[i].attributes.ZLDWMC;
						obj["QSDWMC"] = objArr[i].attributes.QSDWMC;
						obj["GYMJ"] = objArr[i].attributes.GYMJ.toFixed(2);
						
						obj["XMDKBH"] = objArr[i].attributes.XMDKBH;
						obj["GZLX"] = objArr[i].attributes.GZLX;
						obj["SYQSX"] = objArr[i].attributes.SYQSX;
						obj["TDYT"] = objArr[i].attributes.TDYT;
						obj["GHYT"] = objArr[i].attributes.GHYT;
						obj["NGZYT"] = objArr[i].attributes.NGZYT;
						obj["SFBZGH"] = objArr[i].attributes.SFBZGH;
						/*obj["GYMJ"] = objArr[i].attributes.GYMJ;*/
						obj["JTMJ"] = objArr[i].attributes.JTMJ;
						obj["NYDMJ"] = objArr[i].attributes.NYDMJ;
						obj["HFYDMJ"] = objArr[i].attributes.HFYDMJ;
						obj["JHGZNF"] = objArr[i].attributes.JHGZNF;
						obj["BZ"] = objArr[i].attributes.BZ;
						obj["BZ2"] = objArr[i].attributes.BZ2;
						obj["JCFNF"] = objArr[i].attributes.JCFNF;
						break;
						
					case "纳入三旧的旧村":
					case "纳入三旧的集体旧厂":
						obj["ZJMC"] = objArr[i].attributes.ZJMC;
						obj["ZLDWMC"] = objArr[i].attributes.ZLDWMC;
						obj["QSDWMC"] = objArr[i].attributes.QSDWMC;
						obj["JTMJ"] = objArr[i].attributes.JTMJ.toFixed(2);
						
						obj["XMDKBH"] = objArr[i].attributes.XMDKBH;
						obj["GZLX"] = objArr[i].attributes.GZLX;
						obj["SYQSX"] = objArr[i].attributes.SYQSX;
						obj["TDYT"] = objArr[i].attributes.TDYT;
						obj["GHYT"] = objArr[i].attributes.GHYT;
						obj["NGZYT"] = objArr[i].attributes.NGZYT;
						obj["SFBZGH"] = objArr[i].attributes.SFBZGH;
						obj["GYMJ"] = objArr[i].attributes.GYMJ.toFixed(2);
						/*obj["JTMJ"] = objArr[i].attributes.JTMJ;*/
						obj["NYDMJ"] = objArr[i].attributes.NYDMJ;
						obj["HFYDMJ"] = objArr[i].attributes.HFYDMJ;
						obj["JHGZNF"] = objArr[i].attributes.JHGZNF;
						obj["BZ"] = objArr[i].attributes.BZ;
						obj["BZ2"] = objArr[i].attributes.BZ2;
						obj["JCFNF"] = objArr[i].attributes.JCFNF;
						break;
					case "村自留地":
						obj["ZJMC"] = objArr[i].attributes.ZJMC;
						obj["CMC"] = objArr[i].attributes.CMC;
						obj["MJ"] = objArr[i].attributes.MJ.toFixed(2);
						obj["QSDW"] = objArr[i].attributes.QSDW;
						
						obj["SYQXZ"] = objArr[i].attributes.SYQXZ;
						obj["XZYT"] = objArr[i].attributes.XZYT;
						obj["DZ"] = objArr[i].attributes.DZ;
						obj["ZJMC"] = objArr[i].attributes.ZJMC;
						obj["WH"] = objArr[i].attributes.WH;
						obj["PWH"] = objArr[i].attributes.PWH;
						obj["BZ"] = objArr[i].attributes.BZ;
						obj["BZ2"] = objArr[i].attributes.BZ2;
						break;
					case "国有储备用地":
						obj["ZJMC"] = objArr[i].attributes.ZJMC;
						obj["YDMJ"] = objArr[i].attributes.YDMJ.toFixed(2);
						
						obj["SJMC"] = objArr[i].attributes.SJMC;
						obj["QJMC"] = objArr[i].attributes.QJMC;
						obj["BZ"] = objArr[i].attributes.BZ;
						obj["BZ2"] = objArr[i].attributes.BZ2;
						break;
					case "控规":
						obj["ZJMC"] = objArr[i].attributes.ZJMC;
						obj["YDMJ"] = objArr[i].attributes.YDMJ.toFixed(2);
						obj["KGFLDL"] = objArr[i].attributes.KGFLDL;
						obj["KGFLZL"] = objArr[i].attributes.KGFLZL;
						obj["KGFLXL"] = objArr[i].attributes.KGFLXL;
						obj["BZ"] = objArr[i].attributes.BZ;
						obj["BZ2"] = objArr[i].attributes.BZ2;
					case "土规":
						obj["YDMJ"] = objArr[i].attributes.YDMJ.toFixed(2);
						obj["TGFLDL"] = objArr[i].attributes.TGFLDL;
				}
				arr.push(obj);
			}
			this.showLayer[landTypeName]["table"]["tabelData"]=arr;
		},
		//创建高级查询Table列表
		_createAdvQueryTableList:function(landTypeName){
			//将左侧组件展开
			debugger
			if(!Global.widgets.right.hasExpand){
				Global.widgets.right.expandLeft();
			}
			if(this.searchCon.TDLXCon.length <= 1){
				Global.widgets.right.removeAllTab();
			}
			require(["gistech/widgets/QueryTableList/QueryTableList"],lang.hitch(this,function(QueryTableList){
				var queryTableList = new QueryTableList({
					"tableData":this.showLayer[landTypeName]["table"]["tabelData"],
					"columnsData":this.showLayer[landTypeName]["table"]["columnsData"],
					"sortName":this.showLayer[landTypeName]["table"]["sortName"],
					"sortOrder":this.showLayer[landTypeName]["table"]["sortOrder"],
					"exportTableName":this.showLayer[landTypeName]["table"]["exportTableName"]
				});
				queryTableList.startup();
				$('.fixed-table-toolbar',queryTableList.domNode).css({"height":"42px","background-color":"#f5f5f5","margin-bottom":"5px","padding-top":"10px","border-radius": "4px","margin-top": "6px"});
				var headHTML='<span style="font-size: 16px;padding-left: 10px;">'+this.showLayer[landTypeName]["table"]["exportTableName"]+'</span>';
				domConstruct.place(headHTML, $('.fixed-table-toolbar',queryTableList.domNode)[0], "first");
				$('.fixed-table-toolbar .columns',queryTableList.domNode).css({"margin-top":"-5px","margin-right":"10px"});
				//$('.fixed-table-toolbar .search',queryTableList.domNode).css({"position":"absolute"});
				
				$('.fixed-table-toolbar .search',queryTableList.domNode).css({"margin-top":"-28px","margin-left": "158px"});
				if(!ioc.map.userInfoData.isManager){
					$('.fixed-table-toolbar .columns .export',queryTableList.domNode).css("display","none");
				}
				debugger
				if($('.centerPanel>.dijitContentPane>:nth-child(2)',Global.widgets.right.domNode).length == 1){
					$('.centerPanel>.dijitContentPane>:nth-child(2)',Global.widgets.right.domNode).remove();
				}
				var panel = new ContentPane();
				$(panel.domNode).wrapInner(queryTableList.domNode);
				Global.widgets.right.addTab(panel);
				debugger
				//调整搜索框的位置
				var centerPanel=$('.centerPanel',Global.widgets.right.domNode)[0];
				var scrollWidth=centerPanel.offsetWidth-centerPanel.scrollWidth;
				if($('.centerPanel>.dijitContentPane>:nth-child(2)',Global.widgets.right.domNode).length == 1){
					$('.centerPanel>.dijitContentPane>:nth-child(2) .fixed-table-toolbar .search',Global.widgets.right.domNode).css("margin-left",158-scrollWidth+'px');
				}else{
					$('.centerPanel>.dijitContentPane>:nth-child(1) .fixed-table-toolbar .search',Global.widgets.right.domNode).css("margin-left",158-scrollWidth+'px');
				}
				
				if(this.searchCon.TDLXCon.length>1 && this.searchCon.TDLXCon.length == this.onlylandTypeCount){
					$("#wrapper").hideLoading();
				}else{
					$("#wrapper").hideLoading();
				}
				this.closeDialog();
			}));
		},
		//在多个条件 土地类型切换
		_mutiAdvQueryLandType:function(obj){
			debugger
			var landName=obj["mutiAdvQueryLandName"];
			if(landName != undefined){
				this._createAdvQueryTableList(landName);
			}
		},
		//在点击行的时候在当前图层上查询出该graphic
		_queryBlockById:function(paramObj){
			debugger
			var objectId=paramObj["objectId"];
			if(objectId != undefined){
				var graphicLayer=null;
				var landTypeName="";
				if(this.searchCon.TDLXCon.length>1){//单条件
					var $trs=$('.centerPanel>.dijitContentPane>:nth-child(1) tbody>tr',Global.widgets.right.domNode);
					for(var i=0;i< $trs.length;i++){
						if($($trs[i]).css("backgroundColor")=="rgb(255, 252, 204)"){
							landTypeName=$('td:nth-child(2)',$trs[i]).text();
							break;
						}
					}
					graphicLayer=this.showLayer[landTypeName].filterLayer;
				}else{//单条件 + 多条件
					var noEmptyArr=[];
					for(var key in this.searchCon){
						if(this.searchCon[key] instanceof Array){
							if(this.searchCon[key].length != 0){
								noEmptyArr.push(key);
							}
						}
					}
					if(noEmptyArr.length == 1){//单条件
						switch(noEmptyArr[0]){
							case "TDLXCon":
								landTypeName=this.searchCon[noEmptyArr[0]][0];
								break;
							case "KGCon":
								landTypeName="控规";
								break;
							case "TGCon":
								landTypeName="土规";
								break;
						}
						graphicLayer=this.showLayer[landTypeName].filterLayer;
					}else{//多条件
						landTypeName=this.searchCon["TDLXCon"][0];
						graphicLayer=this.showLayer[landTypeName].filterLayer;
					}
				}
				for(var i=0; i < graphicLayer.graphics.length;i++){
					var graphic = graphicLayer.graphics[i],
					color = this.showLayer[landTypeName]["renderColor"],
					line,symbol;
					if(graphic.attributes["OBJECTID"] == objectId){
						if(this.storeClickedGraphic!=null){
							//还原该graphic的渲染
							color = color.substring(color.indexOf("[")+1, color.indexOf("]"));
							colorArr=color.split(",");
							line=new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,255,0.3]), 1);
							symbol=new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,line,new dojo.Color([parseInt(colorArr[0]),parseInt(colorArr[1]),parseInt(colorArr[2]),parseFloat(colorArr[3])]));
							this.storeClickedGraphic.setSymbol(symbol);
						}
						//对该graphic进行渲染
						line=new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,255,255,1]), 3);
					    symbol=new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,line,this.showLayer[landTypeName].filterLayer.renderer.getSymbol().color);
						graphic.setSymbol(symbol);
						this.map.centerAndZoom(graphic.geometry.getCentroid(), 12);
						this.storeClickedGraphic=graphic;
						break;
					}
				}
			}
		}
     });
});